<!--
    客户资产管理
 -->
 <template>
    <div class="page">
        <div class="nuclein-query">
            <div>客户资产管理</div>
            <div style="margin-left: auto;">
            </div>
        </div>
        <div class="content-row">
            <el-table :data="tableData" style="width: 100%" border>
                <el-table-column label="ID" prop="estateId">
                </el-table-column>
                <el-table-column label="名称" prop="estateName">
                </el-table-column>
                <el-table-column label="摄像头数量">
                    <template slot-scope="scope">
                        {{ scope.row.machineCount }}个
                    </template>
                </el-table-column>
                <el-table-column label="一体机数量">
                    <template slot-scope="scope">
                        {{ scope.row.machineCount }}台
                    </template>
                </el-table-column>
                <!-- <el-table-column label="操作" align="center" width="160">
                    <template slot-scope="scope">
                        <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                        <el-button size="mini" type="danger"
                            @click="handleDelete(scope.$index, scope.row.id)">删除</el-button>
                    </template>
                </el-table-column> -->
            </el-table>
        </div>

        <div class="pagination">
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"
                :page-sizes="[10, 20, 30, 40]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
                :total="total">
            </el-pagination>
        </div>
    </div>
</template>

<script>
import { clientAsset, getEstate } from '../../api/api'
export default {

  data () {
    return {
      total: 10,
      page: 1,
      size: 10,
      estateId: '',
      tableData: [],
      estateData: []
    }
  },
  created () {
    this.gitestate()
    setTimeout(() => {
      this.gitList()
    }, 1);
  },
  methods: {
    // 获取
    gitList () {
      const data = {

        page: this.page,
        size: this.size
      }
      clientAsset({ ...data }).then(res => {
        if (res.code == 0) {
          const { total, records } = res.page
          this.total = total
          this.tableData = records
        }
      })
    },
    // 获取小区
    gitestate () {
      getEstate().then(res => {
        if (res.code == 0) {
          this.estateData = res.list
        }
      })
    },
    handlerChange (e) {
    },
    // 分页
    handleSizeChange (val) {
      this.size = val
      this.gitList()
    },
    handleCurrentChange (val) {
      this.page = val
      this.gitList()
    }
  }
}
</script>

<style scoped>
.page {
    position: relative;
    height: 100%;
}

.nuclein-query {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #DCDFE6;
}

.content-row {
    overflow: hidden;
}

.device-type {
    padding: 20px 20px 10px 20px;
}

/* 分页 */
.pagination {
    width: 100%;
    padding: 20px;
    border-top: 1px solid #DCDFE6;
}
</style>
